var _is_first_load = 0;

var _reflash_left = function(index,url){
		//显示左边
		parent._left_nav=parent._nav_top_[index].child;
		parent._do_nav_left();
		if(url){
			parent._do_goto_right(url);
	}
};



var _do_nav_top = function(){ 
	//生成头部菜单
	if(parent._nav_top_){
		var top_nav = $('ul.nav');
		top_nav.empty();
		var i = parent._nav_top_.length,max = i;
		while(i>0){
			var nav = parent._nav_top_[max - i];
			var one ;
			if(i == max){
				one  = parent._set_top_nav(nav,max-i,'selected');
			}else{
				one  = parent._set_top_nav(nav,max-i);
			}
			top_nav.append($(one));
			i--;
		}
	}
	if(_is_first_load == 0){
		$(".nav li").eq(0).find('a').addClass("selected");
		if(parent._home_view){
			//刷新桌面
			//_reflash_left(0,parent.basePath + parent._href_suffix + parent._home_view.href);
			parent.hide_left();
			parent._do_goto_right(parent.basePath + parent._href_suffix + parent._home_view.href);
		}
		_is_first_load = 1;
	}
	
};

$(function(){	
	//window.frames['_id_cache_iframe']._onDefSubmit();
	_do_nav_top();
	$(".nav li a").click(function(){
		var index = $(".nav li a").index(this); 
		if(index ==0){
			//隐藏
			parent.hide_left();
		}else{
			parent.show_left();
		}
		$(".nav li a.selected").removeClass("selected");
		$(this).addClass("selected");
	});
});